<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class OrderGoods extends Model
{
    protected $guarded = [];

    public function order() {
    	return $this->belongsTo(Order::class);
    }

    public function goods()
    {
    	return $this->belongsTo(Goods::class);
    }

    public function getTotalPriceAttribute() {
    	return round($this->goods_quantity * $this->goods->price, 2);
    }
}
